import http from '@/utils/http'

// #埋点
export function Log(params: {
  eventName: string
}) {
  return http.post(`/api/event/report`, {
    ...params,
    env: process.env.NODE_ENV === 'development' ? 'test' : 'prod',
    project: '新康泰克&墨迹天气',
    url: window.location.href,
    sid: undefined, // 本项目不需要
    params: {
      eventName: params.eventName,
    },
  })
}

// #提交表单
export function ContacCiie(params: {
  adcode: string
  date: string
}): Promise<{
    create_time: string
    id: number
    param: string
    result: string
  }> {
  return http.post(`/api/contac-ciie`, params).then(res => res.data)
}

// #根据结果ID查询天气
export function ContacCiieDetail(params: {
  id: string
}): Promise<{
    create_time: string
    id: string
    param: any
    result: any
  }> {
  return http.get(`/api/contac-ciie/detail`, { params }).then(res => res.data)
}
